package fetter

import (
	"encoding/json"
	"fmt"
	"kop/modules/configuration/client"
	"kop/util/log"
)

type Conf struct {
	ID          int32   // 羁绊ID
	Type        int32   // 羁绊类型
	ShipID      int32   // 船只编号
	MaidID      int32   // 侍女编号
	CaptainID1  int32   // 船长编号1
	CaptainID2  int32   // 船长编号2
	CaptainID3  int32   // 船长编号3
	MoneyRate   float64 // 任意船只收益比例
	MoneyRateEX float64 // 特定船只收益比例
	AttributeID int32   // 属性ID
}

var Configs = map[int32]Conf{}

func init() {

	if err := json.Unmarshal(client.Load("CaptainFetters"), &Configs); err != nil {
		panic(err)
	}

	log.Info("Load CaptainFetters.json success.")

	//********************************************************************//
}

func GetFetter(ID int32) Conf {

	var conf, ok = Configs[ID]
	if !ok {
		panic(fmt.Errorf("FetterID not found [%d]", ID))
	}

	return conf
}
